package com.stone.im.controller;

import com.stone.im.common.utils.PageUtils;
import com.stone.im.common.utils.R;
import com.stone.im.entity.MessageSendEntity;
import com.stone.im.service.MessageSendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author xzl
 * @email 860983563@qq.com
 * @date 2022-08-26 16:06:57
 */
@RestController
@RequestMapping("ware/messagesend")
public class MessageSendController {
    @Autowired
    private MessageSendService messageSendService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = messageSendService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{messageId}")
    public R info(@PathVariable("messageId") Long messageId){
		MessageSendEntity messageSend = messageSendService.getById(messageId);

        return R.ok().put("messageSend", messageSend);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody MessageSendEntity messageSend){
		messageSendService.save(messageSend);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody MessageSendEntity messageSend){
		messageSendService.updateById(messageSend);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] messageIds){
		messageSendService.removeByIds(Arrays.asList(messageIds));

        return R.ok();
    }

}
